package com.mew.common.enm;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

public enum JackpotType {

    None (0, "没有"),
    REAL(1, "真"),
    FAKE(2, "假"),
    ;

    private final static Map<Integer, JackpotType> stateMap
            = Arrays.stream(JackpotType.values()).collect(Collectors.toMap(JackpotType::code, code -> code));

    private final int code;
    private final String desc;


    JackpotType(final int code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }

    public String desc() {
        return this.desc;
    }

    public static JackpotType parse(int code) {
        return stateMap.getOrDefault(code, JackpotType.None);
    }

}
